﻿//using Microsoft.AspNetCore.Authorization;
//using Microsoft.AspNetCore.Http;
//using Microsoft.AspNetCore.Mvc;

//namespace RBAC.Api.Writh.Controllers
//{
//    /// <summary>
//    /// API---上传图片
//    /// </summary>
//    [Route("api/[controller]")]
//    [ApiController]
//    [Authorize]
//    public class UpController : ControllerBase
//    {
//        private readonly IWebHostEnvironment web;

//        public UpController(IWebHostEnvironment web)
//        {
//            this.web = web;
//        }
//        /// <summary>
//        /// 上传图片
//        /// </summary>
//        /// <param name="file"></param>
//        /// <returns></returns>
//        [HttpPost]
//        public IActionResult Upload(IFormFile file)
//        {
//          //  Random random = new Random();
//           // var fileName=random.Next(100000, 999999) + file.FileName;
//            var path = Directory.GetCurrentDirectory() + "/wwwroot/img/" + file.FileName;
//            using (FileStream fs = new FileStream(path, FileMode.Create))
//            {
//                file.CopyTo(fs);
//                fs.Flush();
//            }
//            return Ok("http://10.222.11.15:7070/img/" + file.FileName);
//        }
//    }
//}
